package com.dagene.weixin.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.dagene.weixin.util.DateUtil;

@Entity
@Table(name = "weixin_user_info")
public class WeixinUserInfo {

	// id
	long id;
	// 用户的标识
	String openid;
	// 昵称
	String nickname;
	// 性别
	String sex;
	// 用户所在城市
	String city;
	// 用户头像
	String headimgurl;
	// 用户关注时间
	Date subscribetime;
	// 姓名
	String name;
	// 公司
	String company;
	// 手机号码
	String phone;

	// 操作时间字符串
	String subscribetimeStr;

	public WeixinUserInfo() {

	}

	public WeixinUserInfo(String openid, String nickname, String sex,
			String city, String headimgurl, Date subscribetime) {

		this.openid = openid;
		this.nickname = nickname;
		this.sex = sex;
		this.city = city;
		this.headimgurl = headimgurl;
		this.subscribetime = subscribetime;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getHeadimgurl() {
		return headimgurl;
	}

	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}

	public Date getSubscribetime() {
		return subscribetime;
	}

	public void setSubscribetime(Date subscribetime) {
		this.subscribetime = subscribetime;
	}

	@Transient
	public String getSubscribetimeStr() {
		return DateUtil.DateToString(getSubscribetime());
	}

	public void setSubscribetimeStr(String subscribetimeStr) {
		this.subscribetimeStr = subscribetimeStr;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

}
